package com.lfz.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lfz.demo.entity.Notice;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author lfz
 * @date 2025/3/26 14:31
 */
@Mapper
public interface NoticeMapper extends BaseMapper<Notice> {

    /**
     * 根据发布时间倒序查询 3条 通知/公告
     */
    @Select("select * from notice where status = 0 or status = 1  order by modified_time desc limit 3")
    List<Notice> listByStatusLimit3();

    /**
     * 根据发布时间倒叙查询 所有历史通知/公告
     */
    @Select("select * from notice where status = 0 or status = 1 order by modified_time desc")
    List<Notice> partNoticeListDesc();
}
